package com.ruoyi.quartz.task;

import cn.hutool.core.collection.CollectionUtil;
import com.alibaba.fastjson2.JSON;
import com.ruoyi.common.core.redis.RedisCache;
import com.ruoyi.websocket.WebSocketServer;
import com.ruoyi.work.domain.TbLocationUser;
import com.ruoyi.work.domain.TbWorkOrder;
import com.ruoyi.work.domain.TbWorkOrderUser;
import com.ruoyi.work.domain.vo.LocationTrainVo;
import com.ruoyi.work.service.*;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

import java.util.LinkedList;
import java.util.List;
import java.util.Map;
import java.util.TreeMap;

/**
 * 定时任务调度测试
 *
 * @author szm
 */
@Component("locationRedisTask")
public class LocationRedisTask {
    @Autowired
    private RedisCache redisCache;
    @Autowired
    private ITbWorkOrderService tbWorkOrderService;

    public void locationRedis(){
        List<TbWorkOrder> orderList = tbWorkOrderService.lambdaQuery().eq(TbWorkOrder::getStatus, "1").list();
        if (CollectionUtil.isNotEmpty(orderList)){
            for (TbWorkOrder workOrder : orderList){
                String workNo = workOrder.getWorkNo();
                redisCache.deleteObject(workNo);
                redisCache.setCacheObject(workNo, workNo);
            }
        }
    }

}
